package com.vimi8.ebb.auth.api;

import com.vimi8.ebb.auth.configuration.HttpResponseEntity;
import com.vimi8.ebb.auth.dto.AuthUserDto;
import com.vimi8.ebb.auth.dto.OrgMemberTotalDTO;
import com.vimi8.ebb.auth.dto.OrgTotalDTO;
import com.vimi8.ebb.auth.dto.RegUserDto;
import com.vimi8.ebb.auth.model.*;
import io.swagger.annotations.*;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringCodegen", date = "2016-10-11T13:20:24.333Z")
@RestController
@Api(value = "org", description = "the org API")
public interface OrgApi {

//    @ApiOperation(value = "删除组织中某个员工信息", notes = "根据客组织id和员工id解除组织和员工所属关系信息", response = String.class, tags={ "组织信息", })
//    @ApiResponses(value = {
//            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
//            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
//    @RequestMapping(value = "/org/dept/emp/",
//            method = RequestMethod.DELETE)
//    HttpResponseEntity<String> orgDeptEmpDelete(@ApiParam(value = "员工id", required = true) @RequestParam(value = "openId", required = true) String openId
//
//    );



    @ApiOperation(value = "删除组织和用户信息", notes = "删除组织和用户信息", response = String.class, authorizations = {

    }, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/user/",
            method = RequestMethod.DELETE)
    HttpResponseEntity<String> orgUserDelete(@ApiParam(value = "员工id", required = true) @RequestParam(value = "clientId", required = true) String clientId

    );







    @ApiOperation(value = "查询组织部门信息", notes = "通过当前认证信息获取当前登录人的组织信息.", response = OrganizationDept.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,用户信息", response = OrganizationDept.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = OrganizationDept.class) })
    @RequestMapping(value = "/org/dept/",
            method = RequestMethod.GET)
    HttpResponseEntity<OrganizationDept> orgDeptGet(@ApiParam(value = "部门级别（0：顶级部门(股东)，1：管理部门）", required = true) @RequestParam(value = "deptLevel", required = true) String deptLevel


    );

    @ApiOperation(value = "注册新组织部门", notes = "通过传递信息注册新组织部门.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/dept/",
        method = RequestMethod.POST)
    HttpResponseEntity<String> orgDeptPost(

            @ApiParam(value = "用户组信息", required = true) @RequestBody OrganizationDept organizationDept

    );


    @ApiOperation(value = "更新组织部门信息", notes = "通过当前认证信息获取当前登录人的个人信息.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/dept/",
        method = RequestMethod.PUT)
    HttpResponseEntity<String> orgDeptPut(

            @ApiParam(value = "需要更新的个人信息", required = true) @RequestBody OrganizationDept organizationDept

    );



    @ApiOperation(value = "组织授权给员工、管理员、股东", notes = "组织授权给员工、管理员、股东.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/emp/",
            method = RequestMethod.POST)
    HttpResponseEntity<String> orgEmpPost(@ApiParam(value = "userId", required = true) @RequestParam(value = "userId", required = true) String userId
            , @ApiParam(value = "部门id（不传的时候默认是0）") @RequestParam(value = "deptId", required = false) String deptId
            , @ApiParam(value = "工种（org_manager:管理员,  org_shareholder：只是股东，不是员工， org_shareholder_emp：既是股东又是员工，org_senior_manager:高级管理员，org_shareholder_manager： 既是管理员又是股东，org_shareholder_senior_manager：既是股东又是高级管理员, org_emp:组织里面的员工）", required = true) @RequestParam(value = "job", required = true) String job
            , @ApiParam(value = "权限范围(普通员工:user，管理员:admin，高级管理员：senior-admin，股东:shareholder，既是股东也是员工股东:shareholder-user，既是管理员又是股东:shareholder|admin,既是股东又是高级管理员：shareholder|senior-admin)", required = true) @RequestParam(value = "scopes", required = true) String scopes
    );



    @ApiOperation(value = "查询组织信息", notes = "通过当前认证信息获取当前登录人的组织信息.", response = Organization.class, tags={ "组织信息", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,用户信息", response = Organization.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = Organization.class) })
    @RequestMapping(value = "/org/",
        method = RequestMethod.GET)
    HttpResponseEntity<Organization> orgGet();


    @ApiOperation(value = "注册组织", notes = "通过传递信息注册组织.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/",
        method = RequestMethod.POST)
    HttpResponseEntity<String> orgPost(

            @ApiParam(value = "用户组信息", required = true) @RequestBody Organization organization

    );


    @ApiOperation(value = "更新组织信息", notes = "通过当前认证信息获取当前登录人的个人信息.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = { 
        @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
        @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/",
        method = RequestMethod.PUT)
    HttpResponseEntity<String> orgPut(

            @ApiParam(value = "需要更新的个人信息", required = true) @RequestBody Organization organization

    );

    @ApiOperation(value = "查询组织法人信息", notes = "通过当前认证信息获取当前登录人的组织法人信息.", response = AuthUserDto.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,用户信息", response = AuthUserDto.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = AuthUserDto.class) })
    @RequestMapping(value = "/org/corp/",
            method = RequestMethod.GET)
    HttpResponseEntity<AuthUserDto> orgCorpGet();

    @ApiOperation(value = "删除组织", notes = "通过传递信息删除组织.", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/",
            method = RequestMethod.DELETE)
    HttpResponseEntity<String> orgDelete(@ApiParam(value = "组织id", required = true) @RequestParam(value = "orgId", required = true) String orgId


    );
    @ApiOperation(value = "注册组织法人（组织管理员）", notes = "注册组织法人（组织管理员）.", response = RegUser.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,用户信息", response = RegUser.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = RegUser.class) })
    @RequestMapping(value = "/org/corp/",
            method = RequestMethod.POST)
    HttpResponseEntity<RegUser> orgCorpPost(

            @ApiParam(value = "法人注册信息", required = true) @RequestBody(required = false) RegUser regUser
    );

    @ApiOperation(value = "批量注册组织法人（组织管理员）", notes = "批量注册组织法人（组织管理员）.", response = RegUser.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,用户信息", response = RegUser.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = RegUser.class) })
    @RequestMapping(value = "/org/corp/batch/",
            method = RequestMethod.POST)
    HttpResponseEntity<JSONObject> orgCorpBatchPost(
            @ApiParam(value = "法人注册信息", required = true) @RequestParam(required = true,value="regUserListStr") String regUserListStr
    );

    @ApiOperation(value = "导入组织法人信息", notes = "导入组织法人信息.", response = String.class,
            tags = {"组织信息",})
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回导入成功的提示信息", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class)})
    @RequestMapping(value = "/org/corp/import/",
            method = RequestMethod.POST)
    HttpResponseEntity<String> importOrgCorp(HttpServletRequest request,@RequestParam("file") MultipartFile file
    );

    @ApiOperation(value = "查询组织total信息", notes = "根据区域查询所有组织总数和组织雇佣率.", response = OrgTotalDTO.class, authorizations = {
            @Authorization(value = "accessCode", scopes = {
                    @AuthorizationScope(scope = "read:auth-server:user:me", description = "资源auth-server下个人用户信息的读取权限.")
            })
    }, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,用户信息", response = OrgTotalDTO.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = OrgTotalDTO.class) })
    @RequestMapping(value = "/org/emp/",
            method = RequestMethod.GET)
    HttpResponseEntity<OrgTotalDTO> orgEmpGet(
            @ApiParam(value = "组织类型", required = true) @RequestParam(
                    value = "orgClass", required = true) String orgClass,
            @ApiParam(value = "地址代码", required = true) @RequestParam(value = "addressCode", required = true) String addressCode,
            @ApiParam(value = "地址代码", required = false) @RequestParam(value = "group", required = false) String group);

    @ApiOperation(value = "添加组织形式", notes = "添加组织形式", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/class/",
            method = RequestMethod.POST)
    HttpResponseEntity<String> orgClassPost(
            @ApiParam(value = "组织类型（组织形式）", required = true) @RequestBody OrganizationClass organizationClass

    );
    @ApiOperation(value = "查询组织形式", notes = "查询组织形式", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/class/",
            method = RequestMethod.GET)
    HttpResponseEntity<List<OrganizationClass>> orgClassGET(
            @ApiParam(value = "查询组织形式（组织形式）", required = true) @RequestParam(value = "orgClassType", required = true) Integer orgClassType

    );
    @ApiOperation(value = "修改组织形式", notes = "修改组织形式", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/class/",
            method = RequestMethod.PUT)
    HttpResponseEntity<List<OrganizationClass>> orgClassPUT(
            @ApiParam(value = "组织形式", required = true) @RequestParam(value = "组织形式", required = true) @RequestBody OrganizationClass organizationClass

    );
    @ApiOperation(value = "删除组织形式", notes = "删除组织形式", response = String.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回影响行数", response = String.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = String.class) })
    @RequestMapping(value = "/org/class/{id}",
            method = RequestMethod.DELETE)
    HttpResponseEntity<String> orgClassDELETE(
            @ApiParam(value = "删除组织形式）", required = true) @PathVariable(value = "组织形式id", required = true) String id

    );
    @ApiOperation(value = "切换组织", notes = "通过token解析出用户的信息切换到新的组织", response = Token.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回token对象", response = Token.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = Token.class) })
    @RequestMapping(value = "/switch/org/",
            method = RequestMethod.GET)
    HttpResponseEntity<Token> changeOrgPost(
            @ApiParam(value = "orgId", required = true) @RequestParam(value = "orgId", required = true) String orgId
            , HttpServletRequest request
    );

    @ApiOperation(value = "授权审批", notes = "审批农场或", response = Token.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回token对象", response = Token.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = Token.class) })
    @RequestMapping(value = "/org/approval/",
            method = RequestMethod.GET)
    HttpResponseEntity<String> approval(
            @ApiParam(value = "组织id", required = true) @RequestParam(value = "orgId", required = true) String orgId
            , @ApiParam(value = "没有审批通过之前", required = false) @RequestParam(value = "userId", required = false) String userId,
            @ApiParam(value = "审批是否通过", required = true) @RequestParam(value = "isApproval", required = true) int isApproval

    );
    @ApiOperation(value = "申请加入组织", notes = "申请加入组织", response = Token.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回token对象", response = Token.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = Token.class) })
    @RequestMapping(value = "/org/emp/apply/",
            method = RequestMethod.GET)
    HttpResponseEntity<String> applyAddOrg(
            @ApiParam(value = "组织id", required = true) @RequestParam(value = "orgId", required = true) String orgId
            , @ApiParam(value = "工种（org_manager:管理员,  org_shareholder：只是股东，不是员工， org_shareholder_emp：既是股东又是员工，org_senior_manager:高级管理员，org_shareholder_manager： 既是管理员又是股东，org_shareholder_senior_manager：既是股东又是高级管理员, org_emp:组织里面的员工）", required = true) @RequestParam(value = "job", required = true) String job
    );

    @ApiOperation(value = "查询组织下的成员分布情况", notes = "查询组织下的成员分布情况", response = Token.class, tags={ "组织信息", })
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "成功,返回token对象", response = Token.class),
            @ApiResponse(code = 200, message = "失败,返回消息", response = Token.class) })
    @RequestMapping(value = "/org/member/total/",
            method = RequestMethod.GET)
    HttpResponseEntity<OrgMemberTotalDTO> orgMemberTotal(@ApiParam(value = "组织id(不传的时候以当前登录的组织id为准)", required = false) @RequestParam(value = "orgId", required = false) String orgId
    );

}
